package com.luban;

import com.luban.dao.UserMapper;
import com.luban.importdemo.UserImportSelecter;
import com.luban.objectfactorydemo.MyObjectFactory;
import com.luban.objectfactorydemo.Son;
import com.luban.service.UserService;
import org.mybatis.spring.mapper.MapperFactoryBean;
import org.springframework.beans.factory.config.BeanDefinition;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;

public class Test {

	public static void main(String[] args) {

		AnnotationConfigApplicationContext applicationContext = new AnnotationConfigApplicationContext(AppConfig.class);

		UserService userService = applicationContext.getBean("userService", UserService.class);
		userService.test();


		UserImportSelecter userImportSelecter = applicationContext.getBean("com.luban.importdemo.UserImportSelecter", UserImportSelecter.class);


		Object myService = applicationContext.getBean("myFactoryBean");
		Object myFactoryBean = applicationContext.getBean("&myFactoryBean");
		//class com.luban.factorybeandemo.MyService------class com.luban.factorybeandemo.MyFactoryBean
		System.out.println(myService.getClass()+"------"+myFactoryBean.getClass());



		MyObjectFactory myObjectFactory = applicationContext.getBean("myObjectFactory", MyObjectFactory.class);
		Son object = myObjectFactory.getObject();

	}
}
